/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kuliza.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.kuliza.app.model.BaseObject;

/**
 * Student Entity
 * 
 * @author Gaurav Gupta
 */
@Entity
public class Student extends BaseObject {

    private Long id;
    private String name;
    private Integer rollNo;
    private Double marks;
    private String branch;

    public String getBranch() {
        return branch;
    }

    public void setBranch(String branch) {
        this.branch = branch;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getMarks() {
        return marks;
    }

    public void setMarks(Double marks) {
        this.marks = marks;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "roll_no")
    public Integer getRollNo() {
        return rollNo;
    }

    public void setRollNo(Integer rollNo) {
        this.rollNo = rollNo;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Student other = (Student) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.name != other.name && (this.name == null || !this.name.equals(other.name))) {
            return false;
        }
        if (this.rollNo != other.rollNo && (this.rollNo == null || !this.rollNo.equals(other.rollNo))) {
            return false;
        }
        if (this.marks != other.marks && (this.marks == null || !this.marks.equals(other.marks))) {
            return false;
        }
        if (this.branch != other.branch && (this.branch == null || !this.branch.equals(other.branch))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0);
        hash = 97 * hash + (this.rollNo != null ? this.rollNo.hashCode() : 0);
        hash = 97 * hash + (this.marks != null ? this.marks.hashCode() : 0);
        hash = 97 * hash + (this.branch != null ? this.branch.hashCode() : 0);
        return hash;
    }



    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Student { id= " + this.id);
        builder.append(", name=" + this.name);
        builder.append(", rollNo=" + this.rollNo);
        builder.append(", marks=" + this.marks);
        builder.append(", branch=" + this.branch + "}");

        return builder.toString();
    }
}
